
package com.chongchong.user.feign;


import com.chongchong.user.entity.Attach;
import com.chongchong.core.launch.constant.AppConstant;
import com.chongchong.core.tool.api.R;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * User Feign接口类
 *
 * @author
 */
@FeignClient(
	value = AppConstant.APPLICATION_USER_NAME,
	fallback = IAttachClientFallback.class
)
public interface IAttachClient {

	String API_PREFIX = "/attach";

	/**
	 * 文件上传
	 * @param file
	 * @return
	 * @throws IOException
	 */
	@GetMapping(API_PREFIX + "/upload")
	R<Attach> upload(@RequestParam("file") @ApiParam("文件") MultipartFile file ) throws IOException;

	/**
	 * 文件下载
	 * @param response
	 * @param fileId
	 * @return
	 */
	@GetMapping(API_PREFIX + "/download")
	void download(HttpServletResponse response, @RequestParam Long fileId );

}
